-
Notifications
You must be signed in to change notification settings - Fork 69
Extension update: [ArrayTools] add Filter, SortStructuresByField, CopyVariable #2004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension update: [ArrayTools] add Filter, SortStructuresByField, CopyVariable #2004
Conversation
extensions/reviewed/ArrayTools.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you bump the version to 3.1.0? (the minor update to indicate new features)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
extensions/reviewed/ArrayTools.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a line telling this can now "- clone variables" and one for "- filtering or sorting arrays using fields from (nested) structures"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
@BogdanLyopa Slight change of mind on my side but to make it easier for you to maintain this in the future:
If that's ok with you, you can open a new pull request with a new "AdvancedStructureTools.json" in the experimental tier, which is this folder: https://github.com/GDevelopApp/GDevelop-extensions/tree/main/extensions/community. I understand this will take a bit more of your time today, but I think this should make everyone more agile then. |
@4ian Thanks for the suggestion — that makes sense 👍 |
New Functions for ArrayTools Extension
This PR adds three new useful functions for working with arrays and structures in GDevelop.
📋 Overview
CopyVariableFilterSortStructuresByField🔄 CopyVariable
Description
Copies a variable (structure or array) completely with all nested fields. Creates a real deep copy without any links.
Parameters
SourceVariableTargetVariableUsage
🔍 Filter
Description
Filters an array based on a comparison condition. Can filter arrays of numbers, strings, or structures. If
OutputArrayis not specified, the input array is mutated.Parameters
SourceArrayFieldPath"player.score")Operator==,!=,>,<,>=,<=Value/pattern/, number, boolean, or text)OutputArrayUsage
Features
"player.score")/pattern/(e.g.,/^test/)"true"or"false"Examples
Filtering numbers:
Filtering structures:
Filtering with regex:
📊 SortStructuresByField
Description
Sorts an array of structures by a specified field or path. Automatically detects if the value is a number or string and sorts accordingly.
Parameters
ArrayFieldPath"player.score")Usage
Features
"player.score")Examples
Sorting by simple field:
Sorting by nested field:
✨ Benefits
These functions significantly extend the capabilities of working with arrays and structures in GDevelop: